wayland/surface: Compute size on layout
authorJonas Ådahl <jadahl@gmail.com>
Tue, 24 Nov 2020 22:16:48 +0000 (23:16 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 08:46:39 +0000 (09:46 +0100)
Stop using the 'compute-size' phase of the frame clock, use the layout
phase instead, now that GTK isn't using the layout phase anymore.

gdk/gdksurface.c
gdk/gdksurfaceprivate.h
gdk/wayland/gdksurface-wayland.c

index 226a7c7e534060ab12b1dd6611a54ae2308a56b8..ae3dc94b660950e5a7ed17274a8c2f3e27ff1167 100644 (file)
@@ -1375,6 +1375,7 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
                              void          *data)
 {
   GdkSurface *surface = GDK_SURFACE (data);
+  GdkSurfaceClass *class;
 
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
@@ -1387,6 +1388,10 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
   if (surface->update_freeze_count)
     return;
 
+  class = GDK_SURFACE_GET_CLASS (surface);
+  if (class->compute_size)
+    class->compute_size (surface);
+
   g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
 }
 
index 196e2b9aebe92f61279b729417b781b9b19b90d7..cc4e1a1a351c1f6627c7998d2e85ae1b9d1b6631 100644 (file)
@@ -170,6 +170,7 @@ struct _GdkSurfaceClass
                                            gboolean        attached,
                                            GdkGLContext   *share,
                                            GError        **error);
+  void         (* compute_size)           (GdkSurface     *surface);
 };
 
 #define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
index 6a4ae89dad68d48dd3658e987a4677c3c2ddee88..c387dd273621f7fac647b2561049519e642e8b51 100644 (file)
@@ -603,8 +603,7 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
 }
 
 static void
-on_frame_clock_compute_size (GdkFrameClock *clock,
-                             GdkSurface    *surface)
+gdk_wayland_surface_compute_size (GdkSurface *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
@@ -794,7 +793,6 @@ _gdk_wayland_display_create_surface (GdkDisplay     *display,
   gdk_wayland_surface_create_surface (surface);
 
   g_signal_connect (frame_clock, "before-paint", G_CALLBACK (on_frame_clock_before_paint), surface);
-  g_signal_connect (frame_clock, "compute-size", G_CALLBACK (on_frame_clock_compute_size), surface);
   g_signal_connect (frame_clock, "after-paint", G_CALLBACK (on_frame_clock_after_paint), surface);
 
   g_object_unref (frame_clock);
@@ -1448,7 +1446,7 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
     }
 
   impl->surface_geometry_dirty = TRUE;
-  gdk_surface_request_compute_size (surface);
+  gdk_surface_request_layout (surface);
 
   GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
             g_message ("configure, surface %p %dx%d,%s%s%s%s",
@@ -3314,7 +3312,6 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
 
   frame_clock = gdk_surface_get_frame_clock (surface);
   g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
-  g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_compute_size, surface);
   g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_after_paint, surface);
 
   display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
@@ -4110,6 +4107,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->set_opaque_region = gdk_wayland_surface_set_opaque_region;
   impl_class->set_shadow_width = gdk_wayland_surface_set_shadow_width;
   impl_class->create_gl_context = gdk_wayland_surface_create_gl_context;
+  impl_class->compute_size = gdk_wayland_surface_compute_size;
 }
 
 void
@@ -4893,7 +4891,7 @@ gdk_wayland_toplevel_present (GdkToplevel       *toplevel,
   if (!pending_configure)
     {
       impl->surface_geometry_dirty = TRUE;
-      gdk_surface_request_compute_size (surface);
+      gdk_surface_request_layout (surface);
     }
 }